<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('配件店档案列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input id="agentId" name="agentId" th:value="*{agentId}" type="hidden">
                    <div class="select-list">
                        <ul>
                            <!--<li>
                                <label>店铺名称：</label>
                                <input type="text" name="storeName"/>
                            </li>-->
                            <li>
                                <label>联系人：</label>
                                <input type="text" name="storePerson"/>
                            </li>
                            <li>
                                <label>联系方式：</label>
                                <input type="text" name="storePhone"/>
                            </li>
                            <li>
                                <label>状态：</label>
                                <select name="storeState">
                                    <option value="">所有</option>
                                    <option value="1">待审核</option>
                                    <option value="2">通过</option>
                                    <option value="3">驳回</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 140px;">是否订单管理权：</label>
                                <select name="isRaker" th:with="type=${@dict.getType('zsyh_yesno')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('zsyh:partsStore:edit')}]];
        var removeFlag = [[${@permission.hasPermi('zsyh:partsStore:remove')}]];
        var isRakerDatas = [[${@dict.getType('zsyh_yesno')}]];
        var prefix = ctx + "zsyh/repairStore";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "server",
                pagination: true,
                paginationLoop: false,
                pageSize: 5,
                pageNumber: 1,
                modalName: "配件店档案",
                queryParams: function (params) {
                var temp ={
                    storeClassify: '2',
                    agentId: $("#agentId").val(),
                    pageSize: params.limit,
                    pageNum: params.offset / params.limit + 1,
                    pageOffset: params.offset
                };
                return temp;
            },
                columns: [{
                    field : 'Number',
                    title : '序号',
                    align: 'center',
                    width: 20,
                    formatter : function(value, row, index) {
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页
                        return pageSize * (pageNumber - 1) + index + 1;//返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
                    }
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'storeImage',
                    align: 'center',
                    title: '店铺门头',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'storeName',
                    align: 'center',
                    title: '店铺名称'
                },
                {
                    field: 'storePageviews',
                    align: 'center',
                    title: '店铺浏览量'
                },
                {
                    field: 'storeDetailAddress',
                    align: 'center',
                    title: '详细地址'
                },
                {
                    field: 'storePerson',
                    align: 'center',
                    title: '店铺联系人'
                },
                {
                    field: 'storePhone',
                    align: 'center',
                    title: '店铺手机号'
                },
                {
                    field: 'storeBusinessHours',
                    align: 'center',
                    title: '营业时间'
                },
                {
                    field: 'storeOpenYears',
                    align: 'center',
                    title: '开业年限'
                },
                {
                    field: 'storeLicense',
                    align: 'center',
                    title: '营业执照',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                    {
                        field: 'isRaker',
                        align: 'center',
                        title: '是否订单管理权',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(isRakerDatas, value);
                        }
                    },
                {
                    field: 'storeStateName',
                    align: 'center',
                    title: '状态'
                },
                    {
                        field: 'createTime',
                        align: 'center',
                        title: '加入时间'
                    }]
            };
            $.table.init(options);
        });

    </script>
</body>
</html>